function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
import "core-js/modules/es.symbol.js";
import "core-js/modules/es.symbol.description.js";
import "core-js/modules/es.symbol.iterator.js";
import "core-js/modules/es.symbol.to-primitive.js";
import "core-js/modules/es.array.filter.js";
import "core-js/modules/es.array.iterator.js";
import "core-js/modules/es.array.map.js";
import "core-js/modules/es.date.to-primitive.js";
import "core-js/modules/es.number.constructor.js";
import "core-js/modules/es.object.to-string.js";
import "core-js/modules/es.promise.js";
import "core-js/modules/es.regexp.exec.js";
import "core-js/modules/es.regexp.to-string.js";
import "core-js/modules/es.string.iterator.js";
import "core-js/modules/web.dom-collections.iterator.js";
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
/* eslint-disable @typescript-eslint/no-parameter-properties */
/* eslint-disable no-useless-constructor */
import { toUpper } from "lodash";
import { SUGGEST_VERSION } from ".";
export var DefaultOpts = /*#__PURE__*/_createClass(function DefaultOpts(monaco) {
  var _this = this;
  _classCallCheck(this, DefaultOpts);
  _defineProperty(this, "parserType", "mysql");
  _defineProperty(this, "version", SUGGEST_VERSION.V1);
  _defineProperty(this, "charsetList", ["utf8", "utf8mb4", "latin1", "gb2312", "big5"]);
  _defineProperty(this, "language", "sql");
  _defineProperty(this, "onParse", function (_parseResult) {
    //
  });
  // 环境
  _defineProperty(this, "onSuggestEnvs", function () {
    return Promise.resolve([]);
  });
  // charset字符集列表
  _defineProperty(this, "onSuggestCharsets", function () {
    return Promise.resolve(_this.charsetList.map(function (name) {
      return {
        label: name,
        insertText: name,
        sortText: "C_".concat(name),
        kind: _this.monaco.languages.CompletionItemKind.Folder
      };
    }));
  });
  // 时间函数
  _defineProperty(this, "onSuggestTimeFunction", function () {
    return Promise.resolve([]);
  });
  // UDF名称提示
  _defineProperty(this, "onSuggestUdfName", function () {
    return Promise.resolve([]);
  });
  _defineProperty(this, "onSuggestTableNames", function (_cursorInfo) {
    return Promise.resolve([]);
  });
  _defineProperty(this, "onSuggestTableFields", function (_tableInfo, _cursorValue, _rootStatement) {
    return Promise.resolve([]);
  });
  _defineProperty(this, "pipeKeywords", function (keywords) {
    return keywords.filter(function (matching) {
      return matching.type === "string";
    }).map(function (matching) {
      var value = /[a-zA-Z-]+/.test(matching.value.toString()) ? toUpper(matching.value.toString()) : matching.value.toString();
      return {
        label: value,
        insertText: value,
        documentation: "documentation",
        detail: "detail",
        kind: _this.monaco.languages.CompletionItemKind.Keyword,
        sortText: "W_".concat(matching.value)
      };
    });
  });
  _defineProperty(this, "onSuggestFunctionName", function (_inputValue) {
    return Promise.resolve([].map(function (each) {
      return {
        label: each,
        insertText: each,
        sortText: "C_".concat(each),
        kind: _this.monaco.languages.CompletionItemKind.Function
      };
    }));
  });
  _defineProperty(this, "onSuggestFieldGroup", function (tableNameOrAlias) {
    return {
      label: tableNameOrAlias,
      insertText: tableNameOrAlias,
      sortText: "D_".concat(tableNameOrAlias),
      kind: _this.monaco.languages.CompletionItemKind.Folder
    };
  });
  _defineProperty(this, "onHoverTableField", function () {
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    return Promise.resolve([{
      value: "onHoverTableField"
    }, {
      value: "```json\n".concat(JSON.stringify(args, null, 2), "\n```")
    }]);
  });
  _defineProperty(this, "onHoverTableName", function () {
    for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
      args[_key2] = arguments[_key2];
    }
    return Promise.resolve([{
      value: "onHoverTableName"
    }, {
      value: "```json\n".concat(JSON.stringify(args, null, 2), "\n```")
    }]);
  });
  _defineProperty(this, "onHoverFunctionName", function () {
    for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
      args[_key3] = arguments[_key3];
    }
    return Promise.resolve([{
      value: "onHoverFunctionName"
    }, {
      value: "```json\n".concat(JSON.stringify(args, null, 2), "\n```")
    }]);
  });
  this.monaco = monaco;
} // todo
);